

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>mindspore.parallel &mdash; MindSpore master documentation</title>
  

  
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
        <script src="../_static/jquery.js"></script>
        <script src="../_static/underscore.js"></script>
        <script src="../_static/doctools.js"></script>
        <script src="../_static/language_data.js"></script>
        <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    
    <script type="text/javascript" src="../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="mindspore.parallel.nn" href="mindspore.parallel.nn.html" />
    <link rel="prev" title="mindspore.ops.TBERegOp" href="ops/mindspore.ops.TBERegOp.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../index.html" class="icon icon-home"> MindSpore
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">MindSpore Python API</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="mindspore.html">mindspore</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.common.initializer.html">mindspore.common.initializer</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.communication.html">mindspore.communication</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.compression.html">mindspore.compression</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.context.html">mindspore.context</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.dataset.html">mindspore.dataset</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.dataset.audio.html">mindspore.dataset.audio</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.dataset.config.html">mindspore.dataset.config</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.dataset.text.html">mindspore.dataset.text</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.dataset.transforms.html">mindspore.dataset.transforms</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.dataset.vision.html">mindspore.dataset.vision</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.mindrecord.html">mindspore.mindrecord</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.nn.html">mindspore.nn</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.nn.probability.html">mindspore.nn.probability</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.nn.transformer.html">mindspore.nn.transformer</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.numpy.html">mindspore.numpy</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.ops.html">mindspore.ops</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">mindspore.parallel</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.parallel.nn.html">mindspore.parallel.nn</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.profiler.html">mindspore.profiler</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.scipy.html">mindspore.scipy</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.train.html">mindspore.train</a></li>
<li class="toctree-l1"><a class="reference internal" href="mindspore.boost.html">mindspore.boost</a></li>
</ul>
<p class="caption"><span class="caption-text">MindSpore C++ API</span></p>
<ul>
<li class="toctree-l1"><a class="reference external" href="https://www.mindspore.cn/lite/api/zh-CN/master/api_cpp/mindspore.html">MindSpore Lite↗</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">MindSpore</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
        
      <li>mindspore.parallel</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../_sources/api_python/mindspore.parallel.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="mindspore-parallel">
<h1>mindspore.parallel<a class="headerlink" href="#mindspore-parallel" title="Permalink to this headline">¶</a></h1>
<p>并行相关功能的接口。</p>
<dl class="function">
<dt id="get_algo_parameters">
<code class="sig-name descname">get_algo_parameters</code><span class="sig-paren">(</span><em class="sig-param">attr_key</em><span class="sig-paren">)</span><a class="headerlink" href="#get_algo_parameters" title="Permalink to this definition">¶</a></dt>
<dd><p>获取算法参数配置属性。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>属性名称为必填项。此接口仅在AUTO_PARALLEL模式下工作。</p>
</div>
<p><strong>参数：</strong></p>
<ul class="simple">
<li><p><strong>attr_key</strong> (str) - 属性的key。key包括”fully_use_devices”、”elementwise_op_strategy_follow”、”enable_algo_approxi”、”algo_approxi_epsilon”、”tensor_slice_align_enable”和”tensor_slice_align_size”。</p></li>
</ul>
<p><strong>返回：</strong></p>
<p>根据key返回属性值。</p>
<p><strong>异常：</strong></p>
<p>ValueError：无法识别传入的关键字。</p>
</dd></dl>

<dl class="function">
<dt id="reset_algo_parameters">
<code class="sig-name descname">reset_algo_parameters</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#reset_algo_parameters" title="Permalink to this definition">¶</a></dt>
<dd><p>重置算法参数属性。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>此接口仅在AUTO_PARALLEL模式下工作。</p>
</div>
<p>重置后，属性值为：</p>
<ul class="simple">
<li><p>fully_use_devices：True</p></li>
<li><p>elementwise_op_strategy_follow：False</p></li>
<li><p>enable_algo_approxi：False</p></li>
<li><p>algo_approxi_epsilon：0.1</p></li>
<li><p>tensor_slice_align_enable：False</p></li>
<li><p>tensor_slice_align_size：16</p></li>
</ul>
</dd></dl>

<dl class="function">
<dt id="set_algo_parameters">
<code class="sig-name descname">set_algo_parameters</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#set_algo_parameters" title="Permalink to this definition">¶</a></dt>
<dd><p>设置并行策略搜索算法中的参数。有关典型用法，请参见mindspore/tests/ut/python/parallel/test_auto_parallel_resnet.py。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>属性名称为必填项。此接口仅在AUTO_PARALLEL模式下工作。</p>
</div>
<p><strong>参数：</strong></p>
<ul class="simple">
<li><p><strong>fully_use_devices</strong> (bool) - 表示是否仅搜索充分利用所有可用设备的策略。默认值：True。例如，如果有8个可用设备，当该参数设为true时，策略(4, 1)将不包括在ReLU的候选策略中，因为策略(4, 1)仅使用4个设备。</p></li>
<li><p><strong>elementwise_op_strategy_follow</strong> (bool) - 表示elementwise算子是否具有与后续算子一样的策略。默认值：False例如，Add跟随的ReLU，其中ReLU是elementwise算子。如果该参数设置为true，则算法搜索的策略可以保证这两个算子的策略是一致的，例如，ReLU的策略(8, 1)和Add的策略((8, 1), (8, 1))。</p></li>
<li><p><strong>enable_algo_approxi</strong> (bool) - 表示是否在算法中启用近似。默认值：False。由于大型DNN模型的并行搜索策略有较大的解空间，该算法在这种情况下耗时较长。为了缓解这种情况，如果该参数设置为true，则会进行近似丢弃一些候选策略，以便缩小解空间。</p></li>
<li><p><strong>algo_approxi_epsilon</strong> (float) - 表示近似算法中使用的epsilon值。默认值：0.1 此值描述了近似程度。例如，一个算子的候选策略数量为S，如果 <cite>enable_algo_approxi</cite> 为true，则剩余策略的大小为min{S, 1/epsilon}。</p></li>
<li><p><strong>tensor_slice_align_enable</strong> (bool) - 表示是否检查MatMul的tensor切片的shape。默认值：False 受某些硬件的属性限制，只有shape较大的MatMul内核才能显示出优势。如果该参数为true，则检查MatMul的切片shape以阻断不规则的shape。</p></li>
<li><p><strong>tensor_slice_align_size</strong> (int) - 表示MatMul的最小tensor切片的shape，该值必须在[1,1024]范围内。默认值：16。 如果 <cite>tensor_slice_align_enable</cite> 设为true，则MatMul tensor的最后维度的切片大小应该是该值的倍数。</p></li>
</ul>
<p><strong>异常：</strong></p>
<ul class="simple">
<li><p><strong>ValueError</strong> - 无法识别传入的关键字。</p></li>
</ul>
</dd></dl>

</div>


           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="mindspore.parallel.nn.html" class="btn btn-neutral float-right" title="mindspore.parallel.nn" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="ops/mindspore.ops.TBERegOp.html" class="btn btn-neutral float-left" title="mindspore.ops.TBERegOp" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2021, MindSpore.

    </p>
  </div>
    
    
    
    Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    
    provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>